const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
  .ModuleFederationPlugin;
const path = require("path");
const deps = require("./package.json").dependencies;
module.exports = {
  entry: "./src/index",
  mode: "none",
  devServer: {
    contentBase: path.join(__dirname, "dist"),
    port: 3002,
  },
  output: {
    publicPath: "auto",
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        loader: "babel-loader",
        exclude: /node_modules/,
        options: {
          presets: ["@babel/preset-react"],
        },
      },
    ],
  },
  plugins: [
    new ModuleFederationPlugin({
      name: "order",
      // filename: "remoteEntry.js",
      remotes: {
        '@RemoteAlbum': "remoteAlbum@../../album/dist/albumRemoteEntry.js",
      },
      // exposes: {
      //   // "./Navigation": "./src/Navigation",
      //   // "./routes": "./src/routes",
      //   'say': './src/say'
      // },
      // shared: {
      //   ...deps,
      //   react: {
      //     eager: true,
      //     singleton: true,
      //     requiredVersion: deps.react,
      //   },
      //   "react-dom": {
      //     eager: true,
      //     singleton: true,
      //     requiredVersion: deps["react-dom"],
      //   },
      // },
    }),
    new HtmlWebpackPlugin({
      template: "./public/index.html",
    }),
  ],
};
